#include<stdio.h>
#include"array.h"

void sort(int a[], int s, int e) {
	if (s < e) {
		sort(a, s, e - 1);
		int p, t = a[e], i;
		for (p = e - 1; p >= 0; p--)
			if (a[p] <= t)
				break;
		p++;
		if (p - e) {
			for (i = e; i > p; i--)
				a[i] = a[i - 1];
			a[p] = t;
		}
	}
}

int main() {
	int a[] = { 1, 5, 3, 7, 0, 4, 2, 8, 6, 9, };
	int n = sizeof(a) / sizeof(a[0]);
	print(a, n);
	sort(a, 0, n - 1);
	print(a, n);

	return 0;
}
